How do names translate between Mandarin and Cantonese? Firstly I assume (correct me if I'm wrong) that there are always multiple ways to say a Chinese name because the pronunciation depends on the dialect being spoken. I'm curious about how this works.

If a Cantonese-only speaker mentions the name of a Mandarin-only speaker, do they say their name using Mandarin pronunciation or Cantonese pronunciation? What about if the speaker is talking about a very famous person?

If two speakers are both fluent in Cantonese and Mandarin, and code switch with each other in both languages, do they use both pronunciations of each others' names? Would they pick one pronunciation and go with that all the time? Maybe use the pronunciation that the other introduced themselves with? This might be more of a sociolinguistics question.
Firstly I assume (correct me if I'm wrong) that there are always multiple ways to say a Chinese name because the pronunciation depends on the dialect being spoken. 


Yup.


  If a Cantonese-only speaker mentions the name of a Mandarin-only speaker, do they say their name using Mandarin pronunciation or Cantonese pronunciation? What about if the speaker is talking about a very famous person?


The language of the name would, theoretically, be the same as the language being spoken. If the conversation was in Cantonese the name would be read in Cantonese; if the discussion was in Mandarin the name would, likewise, be read in Mandarin. (Although there are catches to this.)


  If two speakers are both fluent in Cantonese and Mandarin, and code switch with each other in both languages, do they use both pronunciations of each others' names? Would they pick one pronunciation and go with that all the time? Maybe use the pronunciation that the other introduced themselves with?


Personal names are seldom spoken between people. A common nickname would be more likely and unless it was in front of others who only spoke one of the languages that they speak it would likely be set in whichever language they are more comfortable in.



So, obviously there are going to be some exceptions.

Nick Cheung has become a joke because he can't pronounce his own name properly in Mandarin. In this commercial he, infamously, calls himself 渣渣辉 instead of 张家辉.

There was once an anecdote that talked about someone interpreting from Cantonese to Mandarin. The translator came across the name 印度 (India) and mistranslated it as something close to 阴道 (vagina) because dou in Cantonese often becomes dao in Mandarin - but in this case it should have been du. 

Names and titles are somewhat ingrained in peoples brains and it is quite hard to switch between the different languages. You might hear people speaking Mandarin and reverting back to their own dialects when they're at a loss.