Point at where the trip ends with to, where it begins with from. Decide the direction your sentence describes first. I walked to the station. works if you're telling someone where you arrived. Use I walked from the station. when you're telling them where you left.
Same trip, different starting point
Ask which end of the trip your sentence points at. If it's where someone left, write I walked from the station. If it's where they arrived, write I walked to the station. Same walk, opposite focus.
Give the whole route in one sentence when both ends matter: The ferry sails from Dover to Calais. The from X to Y pattern fits directions and journey descriptions, so the listener hears the start and finish together.
If only one end matters, drop the other. Someone asks where you're coming from, so I'm coming from the office answers it. Someone asks where you're heading, so I'm heading to the library answers that instead.
Notice the story you tell when the same place appears in both sentences. She moved from the flat means she's left it; She moved to the flat means it's her new home.
A boundary: this covers movement only. Time ranges like from Monday to Friday and origin or material uses follow their own patterns and aren't covered here.
If nothing is travelling, neither word may fit. A verb like stayed or lives usually needs a different preposition, so check for actual movement first.
Working out which one your sentence needs
You're mid-sentence, and the test is simple: does your sentence point at where the trip began, or where it ends? If it's the beginning, you want from; if it's the finish, you want to.
If you're giving someone the whole route, both words go together: The train runs from Leeds to York. The from X to Y pattern works whenever the start and the finish belong in one sentence.
If only one end of the trip matters, use just that one. I'm coming from the gym answers where you started; I'm heading to the gym answers where you're going. You don't need both unless the route itself is the point.
Fold in the boundary: this covers movement only. Time ranges like from Monday to Friday and origin or material uses follow their own patterns, so check that something is actually travelling before you pick either word.