There is a difference, from a security perspective.
When you deposit your bitcoins to MtGox they credit your website account with what are essentially MtGox-bitcoin-credits. These are not bitcoins. If they chose to operate with a fractional reserve system (find out more here), they may have even spent some of the bitcoins, and you wouldn't know unless there was a run on the exchange (like a run on a bank).
Further, MtGox may or may not be able to reimburse you if they somehow lost all your bitcoins. They probably wouldn't reimburse you if someone managed to obtain your login details and withdraw your balance.
However, storing bitcoins yourself has risks too; they can be stolen if your computer is hacked (through malware or a virus). You can however reduce the risk of that to essentially zero by generating an address from an offline computer, printing the details, destroying all electronic traces of it, and transferring your balance there. Of course, then you need to protect your piece of paper...
There is also a difference when it comes to liquidity. If you have the balance stored with MtGox, you have the ability to trade it immediately (provided the website is online).