I don't think I have any sort of chameleon ability. What I do have is experiences. Similar ones to the ones already mentioned here. It took me ages to figure out that in the USA, when someone asks how you're doing, you're not supposed to answer honestly. I think I've built up some sort of database of scripts in my head. I can't tell you how many nights I've lain awake in bed rehearsing normal standard conversations so that I can appear as normal as possible and be prepared for as many different situations as I can.
However, this only helps for things I've encountered before. I have almost no experience with other women, so my conversations with them tend to be very awkward (and I don't really like most of them anyway). I visited England for the first time last week and the cashier at the supermarket greeted me with "You alright?" I was frozen for a second because I'd never heard that as a greeting before and I knew there was probably a simple response I was expected to give, but I had no idea what. I just mumbled something like "yeah, fine." They gave me a funny look so I guess it was the wrong response. If I had spent more time in that country I'm sure I would have deduced the right response, but without that experience there's nothing to be done. I also have no scripts whatsoever for flirting, so when I'm interested in someone I'm pretty hopeless. I'm trying to learn how to do this now, but man is it tough. When you ask an NT what the right thing to say in a given situation is, they just look at you funny most of the time. They learned it all instinctively, so they've never had to think about it, so they really don't know. It's like when a non-native English speaker asks you why you use a certain grammatical structure at certain times; unless you're an expert on English grammar (which most people are not), you really won't know, you just learned to speak naturally and don't know the rules.
Sometimes you'll be awkward and sometimes you'll know the right thing to say. I think the only thing you can do to help is pay as much attention as possible to conversations between other people (TV helps a lot for this since you can observe without looking creepy). You have to accept that you'll really need to analyze conversations rather than absorbing it passively like most people do. You can try what I do and spend a lot of time rehearsing - almost nobody even knows there's anything different about me nowadays. But it's a lot of work for me.