Some dogs do appear to smile when happy, especially if they are panting. However, dogs also pull the corners of their mouths back when afraid or showing submission, so the full body language should be taken into account.
According to neuroscientist Jeffrey Mogil and ABC News, animals and people use the same facial muscles to show emotion, which leads to similar expressions. Dogs who are smiling have other body language to show they are happy as well, including soft eyes, a relaxed posture and loosely wagging tail. A dog who is exhibiting a fearful grin has a tense posture, a tail that is either tucked or held very high, and often shows a lot of white in its eyes.