First, Download ExifTool from the official website. Then:

# Files must be the same extension
exiftool -TagsFromFile FileA.jpeg -overwrite_original FileB.jpeg


For .PNG files, the following must be included in .ExifTool_config in the user’s HOME directory:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PNG::TextualData' => {
        parameters => { }
    },
);

Note that transferring between a .JPEG and a .PNG file is not supported with this method.

More info: ExifTool FAQ