Just like excitement, some dogs will chatter their teeth in fear or anxiety too.
For example, when your dog's teeth chatter just when you leave For work, the dog is anxious and this is how it exhibits it.
When the dog chatters its teeth too often, the friction can cause the teeth to fall.