What happens if you leave the scene of a accident?

If you are involved in the accident it is a crime to leave the scene, but if you are a witness or bystander there is no problem.