There is a script that can get you part of the way there: Jeff Almasol wrote the script called rd_ShapesToMasks – if you are able to locate an active link to it.
Unfortunately, Jeff appears to have taken his excellent site off-line and the script is not easy to find. If your Google skills are good you may be able to locate it, perhaps someone here may know of a new source for these useful scripts.
**Update**
I’ve just tried this on a few shape layers in CS6 and the script no longer appears function. I suppose there were some AE scripting language changes that affect shapes and masks between CS3 when this script functioned well and the current versions of AE.