This question already has an answer here:
I found a useful class in a project that is licensed under Apache 2.0. Can I copy it to a project licensed under MIT license? Add the library as dependency is not an option.
Ideally the answer should quote the corresponding paragraph of the license (MIT and/or Apache 2.0) that describe this case.