Yes, you can use either brand on the other one's hotshoe, and the flash will fire in sync with the exposure being made. But that's the only function you will have. No i-TTL/e-TTL, no high-speed sync (FP), no menu commanding of the flash, no flash exposure compensation, no wake-up from sleep, no 2nd curtain with a Nikon flash on a Canon camera, no matching the zoom to the lens's focal length—anything that requires communication between the flash and the camera body other than the "fire!" signal won't be communicated.
If you look at the camera's hotshoe and the flash's foot, you'll see why.
Nearly every camera manufacturer follows the ISO standard for flash hotshoes (for a while Sony didn't, using the old Minolta iISO hotshoe, but as of the NEX6, they've moved to the ISO-compliant (sorta) multi-interface hotshoe). The ISO standards for flash feet and camera hotshoes give the physical dimensions of the foot and shoe, and specify that the rails on the shoe are ground, and that the contact in the center of the "square" of the foot/shoe is the sync signal.
Everything else is proprietary. Canon and Nikon have their non-sync contacts/pins placed in different areas, so if the flash is seated correctly on the hotshoe, there is no electrical contact and no communication.
However. The four-thirds, micro four-thirds, Fuji X, and Canon hotshoe contacts all use identical placement (although Canon has an additional signal not found on the other two), so if you mix brands among these three, there is the possibility of cross-talk. And since every brand uses a completely different signaling protocol, there could be some errors and possible damage (although the risk is small), so if you're very paranoid, taping over contacts or removing pins might be advisable. I pulled the TTL pins (completely reversible) on an SB-26 to use it on my Canon hotshoes.
On the upside, however, this similar placement also means you can use Canon TTL cables for full TTL function with OEM gear (i.e., you can use a micro four-thirds flash with a micro four-thirds camera over a Canon TTL cable and have full function with TTL and high-speed sync); but this only works with passive cables simply doing signal pass-through. It does not work with TTL-capable radio triggers which may do some form of signal manipulation. However, a newer version of the Fuji X hotshoe now supplies power to accessory flashes with an additional contact the Canon hotshoe doesn't have, so Canon TTL cables will not work with those flashes (such as the EF-X8), as they have no other power source.
While Nikon and Pentax have separate pin arrangements, oddly, the wake-up signal is identical both contact-placement and electronic signal-wise so something like a for-Nikon Yongnuo RF-603II can actually wake up Pentax flashes, but again, there's no TTL/HSS cross-brand with Nikon gear on Pentax.
Sync voltages, if you are using digital-era flash models, should not be an issue. All the digital-era flashes tend to have sync voltages of <10V, and most Canon/Nikon hotshoes have a limit of 250V, while mirrorless cameras are guesstimated to have limits around 20V. The 6V limit you often seen in web references are for the first generation of Canon dSLRs. If you have a Canon camera model that was made after the original dRebel (300D), the limit is 250V.
If you really need cross-brand TTL/HSS compatibility with legacy flashes, you may want to consider the Cactus's X-TTL triggering system.