Movement versus distance
从 is dynamic. It marks the origin of motion or the start of a time span: 从上海飞到北京 (fly from Shanghai to Beijing), 从早上八点工作到晚上十点 (work from 8am to 10pm). 离 is static. It describes how far apart two things are in space or time: 离这儿五公里 (five kilometers from here), 离春节还有两个星期 (two weeks until Spring Festival). Think of 从 as a verb of departure and 离 as a measurement of gap.
Structure: where each preposition sits
从 pattern: 从 + starting point + verb + destination or duration. 从纽约来 (come from New York), 从下午开始学习 (start studying from the afternoon). 离 pattern: A + 离 + B + distance descriptor. 我家离地铁站很近 (my home is close to the subway station), 现在离他的生日还有三天 (now is three days from his birthday). 离 requires a complement describing the distance; 从 requires a verb describing the motion.
我从学校走回家,我家离学校不远。
Wǒ cóng xuéxiào zǒu huí jiā, wǒ jiā lí xuéxiào bù yuǎn.
I walk home from school; my home is not far from school.
Time: 从 for duration, 离 for countdown
从 frames an action starting at a time: 从明天开始 (starting from tomorrow). 离 frames a countdown: 离开会还有十分钟 (ten minutes until the meeting starts). Do not mix them. 从 + a future time means "beginning at"; 离 + a future event means "how much time is between now and it". For "how long ago", use 从 with 到现在: 从他搬走到现在已经两年了 (two years since he moved away).
Common error: saying 从 for distance
English speakers translate "it is 5km from here" as 从这儿五公里, which is wrong. The correct structure uses 离: 离这儿五公里. The error comes from English "from" meaning both origin and distance. In Chinese, origin gets 从 and distance gets 离; the split is strict. Memorize the paired phrases 离...近 (close to) and 离...远 (far from) as a unit.
机场离市中心很远,坐车要一个小时。
Jīchǎng lí shì zhōngxīn hěn yuǎn, zuò chē yào yī gè xiǎoshí.
The airport is far from downtown; it takes an hour by car.