Using a pendulum to drive a nodding mechanism is fairly straightforward. See, for example, the nodding sheep model. Using a pendulum to drive a head shaking mechanism requires an extra level of linkages. Each hinge, each change of direction adds friction to the mechanism slowing things down.

Here's a first draft of such a mechanism. To minimise friction I've used rizla cigarette papers for the hinges. 

It runs for 5-7 secs after being tapped but I'm not sure how strong it is, the cigarette papers are very thin! I'll probably try out a couple more layouts before trying to attach a head.