Officially, it's illegal. Unofficially, as long as you can make it fit and it does not look totally out of place, no one will bother you.
However do understand there are many aspects of consideration if you want to retro fit a tank from another bike. Things like mounting points, clearance beneath the tank, routing of hoses, as well as the angle of the tank on the bike are critical topics.