First, what is whipped cream? Whipped cream is heavy cream that has been whipped (with a whisk) until it becomes light and fluffy. Heavy cream contains at least 36% milkfat. When whipped, the fat forms a foamy structure that holds tiny pockets of air. The food scientists call these “fat-stabilized air bubbles” (check out the pictures). Cream whipped by hand becomes twice the volume of the original liquid.
Inside the whipped cream can heavy cream and nitrous oxide gas mix under pressure. The nitrous oxide permeates the cream, dissolving into the milk fat. When you press the button, the back pressure first shoots the nitrous+cream mix out of the can. Once out of the can the pressure keeping the nitrous dissolved is gone and the nitrous comes boiling out of the cream and in so doing foams it. The boiling is such that the volume of foamed cream is four times the original volume of liquid cream. This is why nitrous foamed cream is lighter than hand whipped cream.
You could make a whipped cream dispenser using a different gas but it would just spray an ooze of thickened milk. This is what you see at the very end of a whipped cream can when the nitrous is gone. Without the nitrous boiling out of the cream, it is just a thick sludge. Similarly, if you were to use a less fatty cream (1/2&1/2 (15% fat) or whole milk (3% fat)) there would be less nitrous dissolved and therefore a less foamy result.
Nitrous Oxide is also bacteriostatic — it stops bacteria from growing (perhaps because it permeates their tissues as well). This allows the canned whipping cream to last longer in the fridge.
Ps: Cool Whip is not whipped cream. It has less than 2% dairy in it. Gross. Stop eating that!