Usually their meaning is similar, but they are only sometimes interchangeable.
The choice between from and out of is related to the choice between at and in. If I am at a place, there will be a way from it; if I am in it, there will be a way out.
In and out of: London, the bath, trouble, a bad mood, hospital.
At and from: home, work, university, the doctor's, London (again, but see below).
Sometimes the 'wrong' choice is valid but with a specific meaning, for example 'out of work' means unemployed.
Place names can be odd too: 'at London' would not be used to refer to the city, but 'from London' is used as normal. Also 'out of' doesn't apply to really big places such as countries which you can be in, but you go from them.