Quaternion.FromToRotation to calculate Rotation between two objects

I’m trying to use Quaternion.FromToRotation function to calculate the exact difference in Euler angle between two objects.

I converted the Quaternion by multiplying the simple direction vector to be used as a parameter.
(How can I convert a Quaternion to a direction vector? - Questions & Answers - Unity Discussions)

But I couldn’t get exact angle difference.

Here is code and screenshot.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestQuaternionFromToRotation : MonoBehaviour
{

    public Transform fromTransform;
    public Transform toTransform;
    public Vector3 fromVector;
    public Vector3 toVector;

    void Update()
    {
        fromVector = fromTransform.rotation * Vector3.up;
        toVector = toTransform.rotation * Vector3.up;

        transform.rotation = Quaternion.FromToRotation(fromVector, toVector);
    }
}

I expected (20, 40, 60), of course, but the results were different.

What’s wrong with this script?
Is it related to Gimbal Lock?

I generally use FromToRotation when I want a specific part of an object to face a specific direction. For example, if I’ve got a robot arm facing some direction, and there’s a hand attached to it at some arbitrary point, and I want to position the hand to pick up a box, I would calculate the rotation like this:

Vector3 currentOffset = arm.transform.InverseTransformPoint(hand.transform.position);
Vector3 desiredOffset = arm.transform.InverseTransformPoint(box.transform.position);
arm.transform.localRotation *= Quaternion.FromToRotation(currentOffset, desiredOffset);

Hope that helps someone!