Depends on the person. Many Japanese I know can tell American from non-American, but that’s usually about the extent of it unless they’ve had actual experience overseas. You need a decent amount of exposure to get fine details, but even non-speakers of languages can figure out major differences if they pay enough attention or have a good ear.
I speak no Chinese at all, but from watching movies where they’re explicitly speaking Mandarin I know a few telltale sounds and the overall flow and sound of that dialect, which is pretty different from Cantonese. (I know from linguistics classes that these are actually separate language families that for historical and political reasons are considered “dialects”.) I can’t tell the difference between Hong Kong, Taiwan, Singapore, or Malaysian flavors of Cantonese just from listening, for example, but if I had enough exposure I might.
My Japanese is good enough to pick out some major well-established accents (Kyoto vs. Osaka vs. Tokyo) and some small regional ones from the countryside where I used to live during the first few years in Japan, but I’m not good enough to get more exact than that for most.
Part of the difficulty is that there’s a lot of code-switching in Japan. Everyone knows “standard” Japanese 標準語 hyōjungo and will often use that on a formal basis (or when talking to non-natives like me) but use a regional dialect with friends and family from that area. Hyōjungo is kind of like RP in the UK.
There are a lot of traditional regional dialects in Japan — practically one per prefecture — since there were not only physical separations, but political and social barriers for literally centuries that kept people from traveling far from their area of origin. Post-War a lot of them have been disappearing. Some of the older people in rural areas are hard for even native younger Japanese people to understand.
Nobody understands what the hell people in Aomori say to each other. It’s seriously worse than Glaswegian compared to RP; might as well be actual Gaelic. Ryukyu (native Okinawan) is really a separate language, not intelligible to standard Japanese speakers, though they are supposedly branches of the same language family. Basically everyone speaks “Japanese” in addition to their native dialect, and modern media and travel have seriously eroded many major differences.
Many South and Central American Spanish accents are fairly easy for me to distinguish, even with only a few years of study spanning middle school and high school. I can’t often tell what area or social class someone is from, but I can usually tell the country. Growing up in California gives you a decent amount of exposure to different Spanish accents. Hell, just from roommates and friends at university I met Spanish speakers from Uruguay, Argentina, Mexico, Guatemala, and Panama.
I was really surprised at the amount of variation in Spain when I took a trip there about 10 years ago, though. I’d learned “Spanish”-Spanish in school (one native teacher from Madrid, one American who studied in Madrid, and another American who spent 3–4 years in Barcelona but consciously taught castellano) and had little exposure to the quite wide variation of different dialects in Spain. Even putting aside Basque, which is a language isolate and really different from anything else in Europe, I was totally thrown by the signs in Catalan when we were in Barcelona.
Looking at my experiences with both Spanish and Japanese which I first was exposed to in an academic setting, it’s kind of trippy how much isn’t taught when you learn a “standard” version of a language. It’s not like you can practically teach a bunch of different regional dialects, but it would be nice if teachers introduced and explained some, at least acknowledge their existence.