You can buy/sell stocks in a click, while a normal transaction of a house takes 30 to 45 days (not including the days the house was listed on the market). This difference may make you hold your depreciated house forever.
The other fundamental difference is you have to be able to afford the house. No matter where the housing market goes, if you cannot afford it, you will end up being foreclosed. With stocks, you can buy one or many as long as you have enough funds.
BTW, housing price doesn't really go up even in a long term.