  Quantum theory features several phenomena which can be considered as
resources for information processing tasks. Some of these effects, such as
entanglement, arise in a nonlocal scenario, where a quantum state is
distributed between different parties. Other phenomena, such as contextuality,
can be observed if quantum states are prepared and then subjected to sequences
of measurements. We use robust remote state preparation to connect the nonlocal
and sequential scenarios and provide an intimate connection between different
resources: We prove that entanglement in a nonlocal scenario can arise only if
there is preparation and measurement contextuality in the corresponding
sequential scenario and that the absence of entanglement implies the absence of
contextuality. As a direct consequence, our result allows us to translate any
inequality for testing preparation and measurement contextuality into an
entanglement test; in addition, entanglement witnesses can be used to design
novel contextuality inequalities.
