Creating dependencies between fields in content type creation form
If you are looking out to do this through code, you can use hook_form_alter to hide the dependent field and hook_node_presave to set the value for dependent field.