It's not as easy as that. It is somewhat a question of context and maybe register. The two words mean the same thing but there are times when only one will do.
For example in this sentence only mistake would be appropriate: 'It was a mistake to ask Helen to come on the trip'.
'This was a serious error of judgement.' Mistake cannot be used in this sentence.
Sometimes it's not so obvious.
'I looked at his maths homework and there were number of errors in is calculations.' In this sentence error is better.
'You have made a number of mistakes in your English essay'. Here mistake is more appropriate.