There are two main forms of Vitamin D that are biologically active in humans. Vitamin D3, or cholecalciferol is the type that is produced by the skin when it is exposed to sunlight. Humans synthesize this vitamin and it is also available in some animal food sources such as fatty fish, eggs, and liver. Milk and some cereals are fortified with Vitamin D3. The other form, D2, is ergocalciferol. This form of vitamin D is found in certain plants, which classifies it as a phytonutrient.
Although Vitamin D requirements generally can include both these sources and they are both usuable by the body, I am focusing on the phytonutrient ergocalciferol on this page.
Certain plants synthesize ergosterols, which can be converted to ergocalciferol when they are exposed to ultraviolet light. Ergosterol performs the same functions in the membranes of fungus cells as cholesterol does in the cells of animals. In animals, cholesterol is the compound that is converted into cholecalciferol, or Vitamin D3.
The best dietary source of ergocalciferol, since we don't eat a huge variety of fungus, is mushrooms. However they need to have some exposure to ultraviolet light either while they are growing or shortly after they are picked to convert the ergosterol into ergocalciferol. If this is a dietary concern of yours, perhaps if you don't eat any animal products including milk and eggs, and you have very little exposure to sunlight, it's a good idea to find a source of mushrooms that grows them with ultraviolet exposure. One such place is Monterey Mushrooms in Watsonville, California.
Apparently both forms of Vitamin D perform the same functions in the body, once they are finally converted into a usable form. This form is either calcitriol or calcidiol, both potent steroid hormones which are necessary for calcium absorption, bone growth and maintenance, neurological and immune system functions, and reducing inflammation. Vitamin D is a subject of research as a treatment or prevention for Addison's Disease, allergic hypersensitivity, Alzheimer's, asthma, Ankylosing Spondylitis, autism, autoimmune disease such as rheumatoid arthritis, several cancers, COPD, systic fibrosis, depression, and other conditions. You can see how widespread and important this vitamin is to our health, affecting nearly every major system.
I haven't been able to find any research that points to specific benefits of ergocalciferol over cholecalciferol. Many studies have used ergocalciferol as the test substance, but didn't follow up by comparing the effects with cholecalciferol. The two appear to be used interchangeably by researchers.
Research suggests that cholecalciferol is actually superior to ergo as a source of Vitamin D. D3 is absorbed and metabolized much more efficiently. However, D2 is derived from plant sources, fungus to be precise, while commercial D3 is harvested from the fat in lambs wool, and the only dietary sources of D3 are animal products. If you are a strict vegan and prefer not to use any animal products, ergocalciferol would be a good choice for your Vitamin D supplement. Also, you would be wise to make sure you get enough sun exposure for your skin to manufacture this vitamin.