In this situation, you could probably put both, but for different reasons. You would feel embarrassed because you were caught stealing the sweets, and you would feel ashamed because you already know that it is wrong to steal. If you do not care that you are stealing, you might still be embarrassed that you were caught in the act. If you are good person or desperate, you will probably feel both feelings.
Another example: I am ashamed that I cheated on my examen, but thank God the teacher never found out.
I am ashamed that I cheated on the test, but I was really embarrassed when he caught me!