Thank you for posting in Microsoft Q&A forum.
We can upgrade Windows Server 2012 R2 in-place to Windows Server 2016 and Windows Server 2019. It is recommended to review the Microsoft documentation on supported upgrade paths to ensure that the upgrade is successful.
On the other hand, SQL Server 2012 can be upgraded in-place to SQL Server 2016 or SQL Server 2017 according to Microsoft documentation. Before upgrading, it is recommended that you stop all Configuration Manager services at the site and upgrade the SQL Server to a supported version. After the SQL Server upgrade is complete, restart the Configuration Manager services.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".