I think that leaving the tension in the center as long as possible without making positional concessions is the best way to go about it. Of course you should break that rule if you can calculate something better.
However for your second example, that position is very drawish at higher levels. You did deny black to right to castle, but with queens off the board and no pieces developed, it matters very little. Black will look to trade off some minor pieces and then the fact that he had not castled becomes an asset, since his king is closer to the center for the endgame. It should be noted that black is in no way playing for a win in that position, but its very tricky for white to come up ahead, which is why White typically avoids the trade.
In general, I find myself declining the trade, and hope that the space pressure forces my opponent into sub-optimal moves. It stops a N from getting to c6 (or f6). I also know that this setup is key as lead-in for the Greek Gift sacrifice.
Of course there are situations where the pawn trade is advisable: