"On your mind" is something that you are thinking of actively. Imagine a thought that repeatedly pops into your head. So, for example, your friend says something and you feel upset. You keep thinking about the words. Your friend's words are "on your mind". You can switch "your" to "my" when referring to yourself. If I were worrying about something I had said to a friend, I could say that my friend's feelings were "on my mind". It means I keep thinking about it.
"In my mind" is usually referring to an opinion and it is not something that you necessarily are thinking of continuously, or repeatedly. For example, you could say "In my mind we should continue along this road", meaning "I think that this road will take us to our destination." You can also say things like "In your mind, what should we do?" or "In your mind, what is the best way of doing this?" In each case you are asking the other person what they think, as in what is their opinion.