They are incredibly related. They are both part of the Speculative Fiction Uber-Genre, and in truth, with the exception of 'Hard Science Fiction'; most of the 'science' in science fiction is really fantasy.
I define things in degrees of how far away from reality they are. There is non-fiction, which is reality.
Then there is non-speculative fiction, which is not reality, but exists in a place of plausibility and even probability (this could be going on right now, or is going on right now). A fiction piece about a soldier in Iraq, would be non-speculative fiction, for example.
Then there is speculative fiction, which is not reality, and although plausible, isn't probable (for right now). However, even under speculative fiction, there is a major divide.
Hard Science Fiction and Hard Alternate History usually exist in the realm of possibility. This could've happened if a certain event happened, or this could be how it happens if a certain event happens.
General Science Fiction and Fantasy exist in a realm of neither possibility or plausibility, and therefore, are disconnected from reality. The vast majority of Science Fiction falls under this vein, even Star Trek (which fields high thinking concepts, but is based on very little actual science).