Eating garbage, eating too fast or too much can bring this on. Also, if you give your dog leftovers or prepare home-cooked meals, remember that a meal served too warm will also cause an upset. There are many opinions on why dogs in particular eat grass. Some say it is because the dog wants to vomit and this helps them along. Others who have noticed that their dogs do not vomit after eating vegetation, think the dog is looking for a particular nutrient and getting it through the grass.
Most vets agree it's nothing to be concerned about.
Just be careful not to let your furbaby have access to lawns treated with pesticide or herbicides. This could cause a much more serious case of poisoning. If vomiting is violent or accompanied by diarrhea, it's time to go to the vet. Other signs of when to get professional help include dizziness or confusion. If blood comes up, get to the vet right away.