well, sleep is a natural receding of order in your brain. it's one of the wonders of human life, actually, that we can have this sort of stage. it is where your body "resets" stuff that's gone wrong and such, since you don't have to use said stuff (since you're, well, asleep)
this state of no-conscious is called, err, "unconscious".
passing out is a much more forced way, like your body panicking as it reealizes it doesn't have enough resources and being forced to shut down as to not deal long-term damage.
with anemia, this occurs because since there isn't enough hemoglobin to carry oxygen, your conscious thought is impaired. sudden movements like sitting up force your heart to pump extra-hard to reach your brain in order to fuel conscious thought and other processes.
so, in order to make sure you don't end up getting hypoxia and/or sudden death, your body turns off a bunch of "toggles" and so fainting occurs.
think of it as turning off your ipad and swiping out of apps to maintain organization vs. turning off your ipad and swiping out of apps to avoid your ipad using up too much energy and dying.