Getting trapped in a tree-well is equally as dangerous as getting buried by an avalanche. In fact, it's claimed that tree-wells account for ~20% of all ski deaths. Every professional guide I've ever skied with has warned that tree wells are just as deadly as avalanches.
You need to treat tree-wells with the same respect you treat avalanche terrain: Don't ski alone; wear a beacon; carry a shovel and probe; and, know how to conduct an avalanche rescue. It's also recommended to keep an eye on your skiing partner, don't go too far without checking over your shoulder to make sure they're still with you. This way you won't get too far ahead of them incase they do end up in a tree-well.
If you fall into a deep well, your very best chance of surviving is to stay calm and grab onto the tree to try and prevent yourself from sinking any deeper. If you can, try to get your skis/snowboard off and get yourself upright. This will expend HUGE amounts of energy, so be wise with every move you make. If possible, you can attempt to climb the tree, but it may be smarter to climb only until you find a pocket of air to breath in, then wait for rescue. This is of course an optimistic best case scenario. I've been head down in tree-wells with skis on before (small ones), any attempts you make to free yourself are absolutely exhausting.
The link provides some more details on what to do in a tree-well emergency.