See: Babies understand dogs
Infants just 6 months old can match the sounds of an angry snarl and a friendly yap to photos of dogs displaying threatening and welcoming body language.But my takeaway of this research is that it is an example of the long history of the relationship of humans and dogs and perhaps represents co-evolution as in early tribes those infants best able to discern a friendly dog from a threatening canine would be the most likely to survive.