How is this useful? You’d use an input boolean because you want to be able to set the state, but if the input always has the value of the sensor, what is there to change? On the other hand, you could have a sensor that reflects the value of the input to make it a kind of read-only value, but even in this case one could just use the input directly.
Anyway, to do it you will need to make an automation that triggers on the sensor’s state change and then call the appropriate service.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.